<include file="public/layout" />
<script type="text/javascript" src="__ROOT__/public/static/js/layer/laydate/laydate.js"></script>

<body style="background-color: rgb(255, 255, 255); overflow: auto; cursor: default; -moz-user-select: inherit;">
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
  <div class="fixed-bar">
    <div class="item-title">
      <div class="subject">
        <h3>商品订单</h3>
        <h5>商城实物商品交易订单查询及管理</h5>
      </div>
    </div>
  </div>
  <!-- 操作说明 -->
  <div id="explanation" class="explanation" style=" width: 99%; height: 100%;">
    <div id="checkZoom" class="title"><i class="fa fa-lightbulb-o"></i>
      <h4 title="提示相关设置操作时应注意的要点">操作提示</h4>
      <span title="收起提示" id="explanationZoom" style="display: block;"></span>
    </div>
     <ul>
      <li>查看操作可以查看订单详情, 包括支付费用, 商品详情等</li>
      <li>未支付的订单可以取消</li>
      <li>用户收货后, 如果没有点击"确认收货",系统自动根据设置的时间自动收货.</li>
    </ul>
  </div>
  <div class="flexigrid">
    <div class="mDiv">
      <div class="ftitle">
        <h3>订单列表</h3>
        <h5>(共{$page->totalRows}条记录)</h5>
      </div>
      <div title="刷新数据" class="pReload"><i class="fa fa-refresh"></i></div>

    </div>
    <div class="hDiv">
      <div class="hDivBox" id="ajax_return">
        <table cellspacing="0" cellpadding="0">
          <thead>
	        	<tr>
	              <th axis="col0">
	                <div style="width: 24px;"><i class="ico-check"></i></div>
	              </th>
	              <th align="left" abbr="order_sn" axis="col3" class="">
	                <div style="text-align: left; width: 60px;" class="">院区ID</div>
	              </th>
	              <th align="left" abbr="consignee" axis="col4" class="">
	                <div style="text-align: left; width: 120px;" class="">院区名称</div>
	              </th>
                <th align="center" abbr="article_time" axis="col6" class="">
                  <div style="text-align: center; width: 60px;" class="">联系人</div>
                </th>               
                <th align="center" abbr="article_time" axis="col6" class="">
                  <div style="text-align: center; width: 60px;" class="">电话</div>
                </th>               
                <th align="center" abbr="article_time" axis="col6" class="">
                  <div style="text-align: center; width: 60px;" class="">地址</div>
                </th>
                <th align="center" abbr="article_time" axis="col6" class="">
                  <div style="text-align: center; width: 60px;" class="">状态</div>
                </th>               
                <th align="center" abbr="article_time" axis="col6" class="">
                  <div style="text-align: center; width: 120px;" class="">操作</div>
                </th>
	            </tr>

	          </thead>
        </table>
      </div>
    </div>
    <div class="tDiv">
      <div class="tDiv2">
<!--           <div class="fbutton"> 
        	<a href="/index.php?m=Admin&c=Order&a=add_order">
	          	<div class="add" title="添加订单">
	            	<span><i class="fa fa-plus"></i>添加订单</span>
	          	</div>
          	</a> 
          </div> -->
      </div>
      <div style="clear:both"></div>
    </div>
    <div class="bDiv" style="height: auto;">
      <div id="flexigrid" cellpadding="0" cellspacing="0" border="0">
        <table>
          <tbody>
            <if condition="empty($list) eq true">
              <tr data-id="0">
                <td class="no-data" align="center" axis="col0" colspan="50">
                  <i class="fa fa-exclamation-circle"></i>没有符合条件的记录
                </td>
              </tr>
            <else />
            <foreach name="$list" item="list">
              <tr>
                <td class="sign" axis="col0">
                <div style="width: 24px;"><i class="ico-check"></i></div>
                </td>
                <td align="left" abbr="order_sn" axis="col3" class="">
                  <div style="text-align: left; width: 60px;" class="">{$list.hospital_id}</div>
                </td>
                <td align="left" abbr="consignee" axis="col4" class="">
                  <div style="text-align: left; width: 120px;" class="">{$list.hospital_name}</div>
                </td><td align="left" abbr="order_sn" axis="col3" class="">
                  <div style="text-align: left; width: 60px;" class="">{$list.tel_user}</div>
                </td>
                <td align="left" abbr="consignee" axis="col4" class="">
                  <div style="text-align: left; width: 60px;" class="">{$list.tel}</div>
                </td>
                <td align="left" abbr="order_sn" axis="col3" class="">
                  <div style="text-align: left; width: 60px;" class="">{$list.address}</div>
                </td>                
                <td align="left" abbr="order_sn" axis="col3" class="">
                  <div style="text-align: left; width: 60px;" class="status">
                    <if condition="$list.zxbz eq 0">
                      <a href="javascript:void(0)" class="btn green" onclick="setzxbz(this)" data-url="{:U('Admin/Hospital/setzxbz',array('id'=>$list['id']))}" data-zxbz="1">启用</a>
                    <else />
                      <a href="javascript:void(0)" class="btn green" onclick="setzxbz(this)" data-url="{:U('Admin/Hospital/setzxbz',array('id'=>$list['id']))}" data-zxbz="0">禁用</a>
                    </if>
                  </div>
                </td>

<!--                 <td align="center" abbr="article_show" axis="col5" class="">
                  <div style="text-align: center; width: 120px;" class="">
                    <div style="text-align: left; ">
                      <a class="btn green" href="{:U('Admin/Order/director_check',array('rec_id'=>$list['rec_id'],'status'=>1))}" data-url=""><i class="fa fa-list-alt"></i>通过</a>
                    </div>
                  </div>
                </td> -->
            <td align="left" axis="col1" class="handle" align="center">
            <div style="text-align: left; ">
              <a class="btn green" href="javascript:void(0)" onclick="allow(this)" data-url="{:U('Admin/Order/director_check',array('rec_id'=>$list['rec_id'],'status'=>$check_status,'hospital_id'=>$hospital_id))}"><i class="fa fa-list-alt"></i>通过</a>
                <a class="btn red" href="javascript:void(0)" onclick="refuse(this)" data-url="{:U('Admin/Order/director_check',array('status'=>4))}" data-rec="{$list['rec_id']}"><i class="fa fa-trash-o"></i>拒绝</a>
            </div>
        </td>
                <td style="width: 100%;">
                  <div></div>
                </td>
              </tr>
            </foreach>
        </if>
          </tbody>
          </table>
          <form action="Admin/Hospital/excel_type" enctype="multipart/form-data" method="post">
            <input type="file" name="excel">
            <input type="submit" >
          </form>
          <form action="Admin/Hospital/updata_goods" enctype="multipart/form-data" method="post">
            <input type="file" name="excel">
            <input type="submit" >
          </form>
      </div>
      <div class="iDiv" style="display: none;">
        <div class="tDiv2">
          <div class="fbutton">
            <a href="{:U('Admin/Hospital/addHospital')}">
              <div class="add" title="添加院区">
                  <span><i class="fa fa-plus"></i>新增品牌</span>
              </div>
            </a>
          </div>
        </div>
      </div>
    </div>
    <!--分页位置--> 
   	</div>
</div>
<script type="text/javascript">

	 
    $(document).ready(function(){		   		
		$('.ico-check ' , '.hDivBox').click(function(){
			$('tr' ,'.hDivBox').toggleClass('trSelected' , function(index,currentclass){
	    		var hasClass = $(this).hasClass('trSelected');
	    		$('tr' , '#flexigrid').each(function(){
	    			if(hasClass){
	    				$(this).addClass('trSelected');
	    			}else{
	    				$(this).removeClass('trSelected');
	    			}
	    		});  
	    	});
		});
		 
	});
    
	function exportReport(){
        var selected_ids = '';
        $('.trSelected' , '#flexigrid').each(function(i){
            selected_ids += $(this).data('order-id')+',';
        });
        if(selected_ids != ''){
            $('input[name="order_ids"]').val(selected_ids.substring(0,selected_ids.length-1));
        }
		$('#search-form2').submit();
	}
	
  function allow(obj){
      $.ajax({
          type : "POST",
          url:$(obj).attr('data-url'),
          // data : {status : 1},
          dataType :'json',
          success: function(data){
            if (data.msg == 1) {
              $(obj).parent().parent().parent().remove();

            }
          },
          error :function(){
            alert('jiaohucuowu');
          }
     });
  }

  function refuse(obj) {
    var info = prompt('请填写拒绝原因');
    // alert($(obj).attr('data-rec'));
    if (info != null && info != '') {
      $.ajax({
          type : "POST",
          url:$(obj).attr('data-url'),
          data : {refuse_info : info,rec_id : $(obj).attr('data-rec')},// 你的formid
          dataType:'json',
          success: function(data){
            // alert(data.msg);
            if (data.msg == 1) {
              $(obj).parent().parent().parent().remove();
            }
          },
          error :function(){
            alert('jiaohucuowu');
          }
     });
    }else{
      return false;
    }
    
  }

 function setzxbz(obj){
  var zxbz = $(obj).attr('data-zxbz');
  // alert(zxbz)
  $.ajax({
    type: 'post',
    url: $(obj).attr('data-url'),
    data: {zxbz: zxbz},
    dataType: 'json',
    success: function (data) {
      // alert(data.msg);
      if (data.msg == 1) {
        $(obj).attr('data-zxbz',0);
        $(obj).text('');
        $(obj).append('禁用');
      }else{
        $(obj).attr('data-zxbz',1);
        $(obj).text('');
        $(obj).append('启用');
      }
    },
    error: function(){
      alert(3432)
    }
  })
 }	 
</script>
</body>
</html>